home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / shaw / vbits16 / vbits16.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  4.2 KB  |  158 lines

  1. // vbits16.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vbits16.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "vbitsdoc.h"
  9. #include "vbitsvw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CVbits16App
  18.  
  19. BEGIN_MESSAGE_MAP(CVbits16App, CWinApp)
  20.     //{{AFX_MSG_MAP(CVbits16App)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28.     // Standard print setup command
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CVbits16App construction
  34.  
  35. CVbits16App::CVbits16App()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CVbits16App object
  43.  
  44. CVbits16App NEAR theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CVbits16App initialization
  48.  
  49. BOOL CVbits16App::InitInstance()
  50. {
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56.     SetDialogBkColor();        // Set dialog background color to gray
  57.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  58.     EnableVBX();               // Initialize VBX support
  59.  
  60.     // Register the application's document templates.  Document templates
  61.     //  serve as the connection between documents, frame windows and views.
  62.  
  63.     CMultiDocTemplate* pDocTemplate;
  64.     pDocTemplate = new CMultiDocTemplate(
  65.         IDR_VBIT16TYPE,
  66.         RUNTIME_CLASS(CVbits16Doc),
  67.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  68.         RUNTIME_CLASS(CVbits16View));
  69.     AddDocTemplate(pDocTemplate);
  70.  
  71.     // create main MDI Frame window
  72.     CMainFrame* pMainFrame = new CMainFrame;
  73.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  74.         return FALSE;
  75.     m_pMainWnd = pMainFrame;
  76.  
  77.     // enable file manager drag/drop and DDE Execute open
  78.     EnableShellOpen();
  79.     RegisterShellFileTypes();
  80.  
  81.     // simple command line parsing
  82.     if (m_lpCmdLine[0] == '\0')
  83.     {
  84.         // create a new (empty) document
  85.         OnFileNew();
  86.     }
  87.     else
  88.     {
  89.         // open an existing document
  90.         OpenDocumentFile(m_lpCmdLine);
  91.     }
  92.  
  93.     m_pMainWnd->DragAcceptFiles();
  94.     // The main window has been initialized, so show and update it.
  95.     pMainFrame->ShowWindow(m_nCmdShow);
  96.     pMainFrame->UpdateWindow();
  97.  
  98.     return TRUE;
  99. }
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // CAboutDlg dialog used for App About
  103.  
  104. class CAboutDlg : public CDialog
  105. {
  106. public:
  107.     CAboutDlg();
  108.  
  109. // Dialog Data
  110.     //{{AFX_DATA(CAboutDlg)
  111.     enum { IDD = IDD_ABOUTBOX };
  112.     //}}AFX_DATA
  113.  
  114. // Implementation
  115. protected:
  116.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  117.     //{{AFX_MSG(CAboutDlg)
  118.         // No message handlers
  119.     //}}AFX_MSG
  120.     DECLARE_MESSAGE_MAP()
  121. };
  122.  
  123. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  124. {
  125.     //{{AFX_DATA_INIT(CAboutDlg)
  126.     //}}AFX_DATA_INIT
  127. }
  128.  
  129. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  130. {
  131.     CDialog::DoDataExchange(pDX);
  132.     //{{AFX_DATA_MAP(CAboutDlg)
  133.     //}}AFX_DATA_MAP
  134. }
  135.  
  136. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  137.     //{{AFX_MSG_MAP(CAboutDlg)
  138.         // No message handlers
  139.     //}}AFX_MSG_MAP
  140. END_MESSAGE_MAP()
  141.  
  142. // App command to run the dialog
  143. void CVbits16App::OnAppAbout()
  144. {
  145.     CAboutDlg aboutDlg;
  146.     aboutDlg.DoModal();
  147. }
  148.  
  149. /////////////////////////////////////////////////////////////////////////////
  150. // VB-Event registration
  151. // (calls to AfxRegisterVBEvent will be placed here by ClassWizard)
  152.  
  153. //{{AFX_VBX_REGISTER_MAP()
  154. //}}AFX_VBX_REGISTER_MAP
  155.  
  156. /////////////////////////////////////////////////////////////////////////////
  157. // CVbits16App commands
  158.